import { IsString, IsNotEmpty, IsOptional, IsArray, IsMongoId, IsNumber } from 'class-validator';
import { Schema as MongooseSchema } from 'mongoose';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateRoleDto {
  @ApiProperty({ description: '角色名称', example: '管理员' })
  @IsString()
  @IsNotEmpty()
  name: string;

  @ApiPropertyOptional({ description: '角色编码', example: 'ADMIN' })
  @IsString()
  @IsOptional()
  code?: string;

  @ApiPropertyOptional({ description: '角色描述' })
  @IsString()
  @IsOptional()
  description?: string;

  @ApiPropertyOptional({ description: '所属组织ID' })
  @IsMongoId()
  @IsOptional()
  orgId?: MongooseSchema.Types.ObjectId;

  @ApiPropertyOptional({ description: '权限ID列表', type: [String] })
  @IsArray()
  @IsMongoId({ each: true })
  @IsOptional()
  permissionIds?: MongooseSchema.Types.ObjectId[];

  @IsString()
  @IsOptional()
  remark?: string;

  @IsNumber()
  @IsOptional()
  status?: number;
} 